﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x020003A9 RID: 937
public class ModalChoices : ModalUI
{
	// Token: 0x0600175D RID: 5981 RVA: 0x0009BBB8 File Offset: 0x00099DB8
	protected override void Awake()
	{
		base.Awake();
	}

	// Token: 0x0600175E RID: 5982 RVA: 0x0009BBC0 File Offset: 0x00099DC0
	public void SetUp(string text, string[] texts, Action[] acts)
	{
		this.text.text = text;
		this.sets = new ModalChoices.Set[acts.Length];
		for (int i = 0; i < texts.Length; i++)
		{
			this.sets[i] = new ModalChoices.Set(this, i, acts);
			GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.choiceOriginal);
			gameObject.SetActive(true);
			gameObject.transform.SetParent(this.choicesRoot, false);
			gameObject.GetComponentInChildren<Text>().text = texts[i];
			gameObject.GetComponentInChildren<Button>().onClick.AddListener(new UnityAction(this.sets[i].Choice));
		}
	}

	// Token: 0x04001B03 RID: 6915
	public Canvas myCanvas;

	// Token: 0x04001B04 RID: 6916
	public Text text;

	// Token: 0x04001B05 RID: 6917
	public GameObject choiceOriginal;

	// Token: 0x04001B06 RID: 6918
	public Transform choicesRoot;

	// Token: 0x04001B07 RID: 6919
	private ModalChoices.Set[] sets;

	// Token: 0x020003AA RID: 938
	private class Set
	{
		// Token: 0x0600175F RID: 5983 RVA: 0x0009BC64 File Offset: 0x00099E64
		public Set(ModalChoices owner, int no, Action[] acts)
		{
			this.owner = owner;
			this.no = no;
			this.act = null;
			if (no < acts.Length)
			{
				this.act = acts[no];
			}
		}

		// Token: 0x06001760 RID: 5984 RVA: 0x0009BC94 File Offset: 0x00099E94
		public void Choice()
		{
			SystemSE.Play(SystemSE.SE.CHOICE);
			if (this.act != null)
			{
				this.act();
			}
			this.owner.End();
		}

		// Token: 0x04001B08 RID: 6920
		public ModalChoices owner;

		// Token: 0x04001B09 RID: 6921
		public int no;

		// Token: 0x04001B0A RID: 6922
		public Action act;
	}
}
